/**
 * Created by lock
 * Date: 2019-08-09
 * Time: 18:25
 */
package logic

import (
	"github.com/sirupsen/logrus"
	"gochat/config"
	"runtime"
)

type Logic struct {
}

func New() *Logic {
	return new(Logic)
}

func (logic *Logic) Run() {
	// 读取配置文件
	logicConfig := config.Conf.Logic
	//设置cpu核心数
	runtime.GOMAXPROCS(logicConfig.LogicBase.CpuNum)

	// 初始化发布redis
	if err := logic.InitPublishRedisClient(); err != nil {
		logrus.Panicf("logic init publishRedisClient fail,err:%s", err.Error())
	}

	// 初始化rpc服务
	if err := logic.InitRpcServer(); err != nil {
		logrus.Panicf("logic init rpc server fail")
	}
}
